package cn.demo.client.domain.dto;

import cn.demo.common.utils.bean.BeanUtils;
import cn.demo.pm.domain.PmStoreOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

@Data
public class OrderCreateDto {
    @Schema(description = "商品id")
    @NotBlank(message = "商品id不能为空")
    private String goodsId;

    @Schema(description = "商品数量")
    @NotNull(message = "商品数量不能为空")
    @Min(value = 1,message ="商品数量至少为1" )
    private Integer goodsNum;

    @Schema(description = "手机号")
    @NotBlank(message = "手机号不能为空")
    private String phone;

    @Schema(description = "配送地区")
    @NotBlank(message = "配送地区不能为空")
    private String expressArea;

    @Schema(description = "配送地址")
    @NotBlank(message = "配送地址不能为空")
    private String expressAddr;

    public PmStoreOrder toEntry(){
        return BeanUtils.copy(this,PmStoreOrder.class);
    }
}
